using System.Security.Cryptography;

public class hash_hmac_sha1
{

    public string getHMAC(string signatureString, string secretKey)
    {


        System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();

        byte[] keyByte = encoding.GetBytes(secretKey);


        HMACSHA1 hmac = new HMACSHA1(keyByte);


        byte[] messageBytes = encoding.GetBytes(signatureString);

        byte[] hashmessage = hmac.ComputeHash(messageBytes);


        return ByteArrayToHexString(hashmessage);

    }

    private string ByteArrayToHexString(byte[] bytes)
    {
        System.Text.StringBuilder stringBuilder =
        new System.Text.StringBuilder(bytes.Length * 2);

        char[] chars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };

        foreach (byte b in bytes)
        {
            stringBuilder.Append(chars[b >> 4]).Append(chars[b & 0x0F]);
        }

        return stringBuilder.ToString();
    }
}